﻿using ConfigHelper.Common;
using DataAccessLayer.BaseInterface;
using IDataAccessLayer;
using Model;
using Model.Extend_Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccessLayer
{
    public class Teacher_ExtendDataAccessLayer : BaseDataAccessLayer<Teacher_Extend>, ITeacher_ExtendDataAccessLayer
    {
        public override string TableName
        {
            get { return "Teacher_Extend"; }
        }

        public override Dictionary<string, bool> PKname
        {
            get {
                Dictionary<string, bool> dic = new Dictionary<string, bool>();
                dic.Add("TeacherId", false);
                return dic;
            }
        }


        #region 老师信息
        public List<Teacher_Extend> GetTeacherList(params SqlParameter[] param)
        {
            //调用common 中拼好的Sql语句
            string Sql = Common.GetTeacherList<Teacher_Extend>(param);

            //调用DBHelper 返回DataTable类型
            DataTable dt = DBhelper.GetDataSet(Sql);

            List<Teacher_Extend> Teacher = new List<Teacher_Extend>();
            foreach (DataRow item in dt.Rows)
            {
                Teacher_Extend Teachers = new Teacher_Extend();
                foreach (var i in Teachers.GetType().GetProperties())
                {
                    i.SetValue(Teachers, item[i.Name]);
                }
                Teacher.Add(Teachers);
            }
            return Teacher;
        }

        #endregion

    }
}
